package com.study.easyexcel.common.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentLoopMerge;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.converters.string.StringImageConverter;

import java.io.File;
import java.io.InputStream;

/**
 * 图形文件附加，用于导出图片，请注意，所有的图片都会放到内存；可以根据不同的数据类型实现导出，如：
 * {@link String}   必须指定转换器{@link StringImageConverter}
 * {@link File}     设置抽象路径{@code new File(imagePath)}
 * {@link InputStream}
 * {@link byte[]}   设置字节数组{@code FileUtils.readFileToByteArray(new File(imagePath))}
 *
 * @author yuhuan
 * @date 2023/5/10
 */
@ContentRowHeight(20)
public class AdditionalImage {

    @ColumnWidth(100 / 10)
    @ExcelProperty(value = "相册", converter = StringImageConverter.class)
    public String img;

    @ColumnWidth(120 / 10)
    @ExcelProperty(value = "附件")
    public File file;

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }
}
